<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 1.Number.EPSILON用于解决浮点数精度问题，其表示JS表示的最小精度
        console.log(0.1 + 0.2 === 0.3);//false,具有机器误差
        function equal(a, b) {
            if(Math.abs(a-b) < Number.EPSILON){
                return true
            }else{
                return false
            }
        }
        console.log(equal(0.1 + 0.2, 0.3));
        console.log('==============');

        // 2.进制的表示
        let b = 0b1010 //二进制
        let o = 0o777 //八进制
        let d = 100 //十进制
        let x = 0xff //十六进制
        console.log(b);// 10
        console.log('==============');

        // 3.Number.isFinite 检测一个数是否是有穷数
        console.log(Number.isFinite(100));//false
        console.log(Number.isFinite(100/0));//true
        console.log(Number.isFinite(Infinity));
        console.log('==============');

        // 4.Number.isNaN 检测一个数值是否为NaN
        console.log(Number.isNaN(123));//false
        console.log('==============');

        // 5.Number.parseInt 转型
        console.log(Number.parseInt(3.06));//3
        console.log('==============');

        // 6.Number.isInteger 判断是否为整数
        console.log(Number.isInteger(3.5));//false
        console.log('==============');

        // 7.Math.trunc 将数字的小数部分抹掉
        console.log(Math.trunc(3.666));//3
        console.log('==============');

        // 8.Math.sign 判断一个数是正数负数还是0
        console.log(Math.sign(100));
        console.log(Math.sign(0));
        console.log(Math.sign(-100));
    </script>
</body>
</html>